--
-- DESCRIPTION
--
-- @COMPANY **
-- @AUTHOR **
-- @DATE ${date} ${time}
--

---@type BTD_CanAttackTarget_C
local M = UnLua.Class()

local ActionCharClass = UE.UClass.Load("/ActionPlatformer/Blueprints/Characters/BP_ActionChar.BP_ActionChar_C")

function M:PerformConditionCheckAI(OwnerController, ControlledPawn)
    self.CharacterAI = ControlledPawn:Cast(ActionCharClass)
    if self.CharacterAI.IsDefeated then
        print("自己死了")
        return false
    end

    local Actor = UE.UBTFunctionLibrary.GetBlackboardValueAsActor(self, self.AttackTarget)

    if not Actor then
        return false
    end

    local SeeThePlayer = UE.UBTFunctionLibrary.GetBlackboardValueAsBool(self, self.SeeThePlayer)

    self.AttackChar = Actor:Cast(ActionCharClass)

    if self.AttackChar and not self.AttackChar.IsDefeated and SeeThePlayer then
        return true
    else
        return false
    end

end

return M